using UnityEngine;
using System.Collections;

public class ComputerMove : MonoBehaviour {
	public int moveSpeed = 140;  //per second
	Vector3 computerDirection = Vector3.left;
	
	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		Vector3 newPosition = Vector3.zero;
		newPosition = computerDirection * (moveSpeed * Time.deltaTime);
		newPosition.x = Mathf.Clamp(newPosition.x, -101, 126);
		newPosition = newPosition + transform.position;
		
		if(newPosition.x > 126)
		{
			newPosition.x = 126;
			computerDirection.x *= -1;
		}
		else if(newPosition.x < -101)
		{
			newPosition.x = -101;
			computerDirection.x *= -1;
		}
	}
	
}
